﻿using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAO;
using System.Data;
using System.Data.SqlClient;
namespace BUS
{
    public class KQBUS
    {
        public static Boolean InsertKetQua(TTKetQuaDTO tt)
        {
            bool ok = false;
            tt.KQDaiThe1 = tt.KQDaiThe1 =="" ?"":tt.KQDaiThe1;
            tt.KQDaiThe2 = tt.KQDaiThe2 == "" ? "" : tt.KQDaiThe2;
            tt.KQViThe1 = tt.KQViThe1 == "" ? "" : tt.KQViThe1;
            tt.KQViThe2 = tt.KQViThe2 == "" ? "" : tt.KQViThe2;
            tt.KetLuan1 = tt.KetLuan1 == "" ? "" : tt.KetLuan1;
            tt.KetLuan2 = tt.KetLuan2 == "" ? "" : tt.KetLuan2;
            ok = InsertKQDAO.InsertKetQua(tt);
           
            return ok;
        }

        public static Boolean InsertKetQuaPAP(TTKetQuaPAPDTO tt)
        {
            bool ok = false;
            ok = InsertKQDAO.InsertKetQuaPAP(tt);

            return ok;
        }

        public static Boolean InsertKetQuaPAP_dtl(string SoBN, int IDBenh, int IDNhom)
        {
            bool ok = false;
            ok = InsertKQDAO.InsertKetQuaPAP_dtl(SoBN, IDBenh, IDNhom);

            return ok;
        }

        public static Boolean InsertCDThem(string SoTieuBan, string IDHM, int Loai,
                                string MauBenhPham, string ChanDoanGPB, string PUser, string Host
                                , int IDBs, string TenBS)
        {
            bool ok = false;
            ok = InsertKQDAO.InsertCDThem( SoTieuBan,  IDHM,  Loai,
                                 MauBenhPham, ChanDoanGPB,  PUser,  Host
                                 ,IDBs,TenBS);

            return ok;
        }

        public static Boolean InsertCDHoanTien(string SoTieuBan, string IDHM, string MauBenhPham
                                        , string ChanDoanGPB, int Tien, int IDBs, string PUser
                                        , string Host, int soluong)
        {
            bool ok = false;
            ok = InsertKQDAO.InsertCDHoanTien(SoTieuBan, IDHM, MauBenhPham, ChanDoanGPB,Tien , IDBs
                                                , PUser, Host, soluong);

            return ok;
        }

        public static Boolean UpdateKetQua(TTKetQuaDTO tt)
        {
            bool ok = false;

            ok = InsertKQDAO.UpdateKetQua(tt);
            return ok;
        }

        public static Boolean UpdateKetQuaPAP(TTKetQuaPAPDTO tt)
        {
            bool ok = false;

            ok = InsertKQDAO.UpdateKetQuaPAP(tt);
            return ok;
        }

        public static Boolean DeleteKQ(string SoBN, string SoTB)
        {
            bool ok = false;

            ok = InsertKQDAO.DeleteKQ(SoBN,SoTB);
            return ok;
        }

        public static Boolean DeleteKQPAP(string SoBN)
        {
            bool ok = false;
            ok = InsertKQDAO.DeleteKQPAP(SoBN);
            return ok;
        }

        public static Boolean DeleteGPB_CD_XNBOXUNG(string SoTB)
        {
            bool ok = false;
            ok = InsertKQDAO.DeleteGPB_CD_XNBOXUNG(SoTB);
            return ok;
        }

        public static Boolean DeleteGPB_CD_HoanTien(string SoTB)
        {
            bool ok = false;
            ok = InsertKQDAO.DeleteGPB_CD_HoanTien(SoTB);
            return ok;
        }

        public static Boolean DeleteKQPAP_dtl(string SoBN )
        {
            bool ok = false;
            ok = InsertKQDAO.DeleteKQPAP_dtl(SoBN);
            return ok;
        }

        public static Boolean UpdateXacNhan(string SoBN, string stb, int lan)
        {
            bool ok = false;
            ok = InsertKQDAO.UpdateXacNhan(SoBN, stb, lan);
            return ok;
        }

        public static Boolean UpdateFee(string SoBN, string SoHS, string SoNVien, bool bThucHien 
                                    , int LoaiBN, string DVCode, SqlConnection ConnPK)
        {
            bool ok = false;
            ok = InsertKQDAO.UpdateFee(SoBN, SoHS, SoNVien, bThucHien
                                    , LoaiBN, DVCode, ConnPK);
            return ok;
        }

        public static DataTable GetKetQua(string SoBN, string SoHS
                                        , string SoTB,int lan)
        {
            DataTable dtKQ = new DataTable();
            dtKQ = InsertKQDAO.GetKetQua(SoBN, SoHS, SoTB, lan);
            return dtKQ;
        }

        public static DataTable GetKetQua(string SoTB, int lan)
        {
            DataTable dtKQ = new DataTable();
            dtKQ = InsertKQDAO.GetKetQua(SoTB, lan);
            return dtKQ;
        }
        public static DataTable GetKetQua(int lan, string SoHS)
        {
            DataTable dtKQ = new DataTable();
            dtKQ = InsertKQDAO.GetKetQua(lan, SoHS );
            return dtKQ;
        }

        public static DataTable GetKetQua(string SoBN, string SoHS, string SoTB)
        {
            DataTable dtKQ = new DataTable();
            dtKQ = InsertKQDAO.GetKetQua(SoBN, SoHS, SoTB);
            return dtKQ;
        }

        public static DataTable GetKetQuaPAP(string SoBN, string SoHS)
        {
            DataTable dtKQ = new DataTable();
            dtKQ = InsertKQDAO.GetKetQuaPAP(SoBN, SoHS);
            return dtKQ;
        }

        public static DataTable GetKetQuaPAP_STB(string SoTB)
        {
            DataTable dtKQ = new DataTable();
            dtKQ = InsertKQDAO.GetKetQuaPAP_STB(SoTB);
            return dtKQ;
        }

        public static DataTable GetKetQuaSTB(string SoTB)
        {
            DataTable dtKQ = new DataTable();
            dtKQ = InsertKQDAO.GetKetQuaSTB(SoTB);
            return dtKQ;
        }

        public static DataTable GetMax(int loai, int nam, int thang)
        {
            DataTable dtKQ = new DataTable();
            dtKQ = InsertKQDAO.GetMax( loai,  nam,  thang);
            return dtKQ;
        }
    }
}
